package net.zypro.sample.model;

public class ErrorMessage {
	/***/
    public static final int SERVER_UNKNOWN_ERROR=1000;
    /***/
    public static final int SERVICE_UNAVAILABLE_ERROR=1001;
    /***/
    public static final int CLIENT_AUTH_FAILED_ERROR=2002;
    /***/
    public static final int USER_AUTH_FAILED_ERROR=2003;
    
    public static final int CLIENT_PARAMS_ERROR=2004;
	
	private int code;
    private String message;

    public ErrorMessage(){}

    public ErrorMessage(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public ErrorMessage(int code)
    {
        this.code=code;

        switch (code)
        {
            case SERVER_UNKNOWN_ERROR:
                this.message="服务器未知异常";
                break;
            case SERVICE_UNAVAILABLE_ERROR:
                this.message="服务暂不可用";
                break;
            case CLIENT_AUTH_FAILED_ERROR:
                this.message="客户端认证失败";
                break;
            case USER_AUTH_FAILED_ERROR:
            	this.message="用户认证失败";
            	break;
            case CLIENT_PARAMS_ERROR:
            	this.message="参数缺少或错误";
            	break;
            default:
                this.message="";
        }
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
